﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HashSetTest1
{
    class Program
    {
        static void Main(string[] args)
        {
            //List<int> list1 = new List<int>();
            //list1.Add(3);
            //list1.Add(5);
            //list1.Add(3);

            //HashSet<int> set1 = new HashSet<int>();
            //set1.Add(3);
            //set1.Add(5);
            //set1.Add(3);
            ////HashSet只会保留不重复的数据
            //foreach(int i in set1)
            //{
            //    Console.WriteLine(i);
            //}

            int[] nums = { 9, 8, 5, 3, 1, 10, 2, 7 };

            HashSet<int> set2 = new HashSet<int>();
            foreach (int i in nums)
            {
                set2.Add(i);
            }
            for (int i = 1; i <= 10; i++)
            {
                if (!set2.Contains(i))
                {
                    Console.WriteLine(i);
                }
            }

                Console.ReadKey();
        }
        //static int Add(int n)
        //{
        //    return n * (n + 1) / 2;
        //}
    }


}
